package com.gopay.bis.icbc.expay.operation;

import java.util.HashMap;
import java.util.Map;

import org.apache.xmlbeans.XmlOptions;

import com.gopay.bis.common.util.constants.Constants4BankSwitch;


public abstract class XmlUtil {

	/**
	 * 构建Transformer子类中的format方法使用的XmlOptions对象
	 * @param xmlBeansUrl
	 * @return
	 */
	public static XmlOptions buildFormatXmlOptions(String xmlBeansUrl){
		XmlOptions xmlOptions = new XmlOptions();
		xmlOptions.setSavePrettyPrint().setSavePrettyPrintIndent(Constants4BankSwitch.PRETTY_PRINT_INDENT);
		xmlOptions.setCharacterEncoding(Constants4BankSwitch.ENCODING);
		xmlOptions.setUseDefaultNamespace();
		Map nameSpace = new HashMap();
		nameSpace.put("", xmlBeansUrl);
		xmlOptions.setSaveImplicitNamespaces(nameSpace);
		return xmlOptions;
	}
	
	/**
	 * 构建Transformer子类中的parse方法使用的XmlOptions对象
	 * @param sendXmlNameSpace
	 * @return
	 */
	public static XmlOptions buildParseXmlOptions(String sendXmlNameSpace){
		XmlOptions xmlOptions = new XmlOptions();
		Map nameSpace = new HashMap();
		nameSpace.put("", sendXmlNameSpace);
		xmlOptions.setSaveImplicitNamespaces(nameSpace);
		return xmlOptions;
	}
}